import Service from '@/common/service/service';
import RequestModel from "@/common/model/request.model";
import ResponseModel from '@/common/model/response.model';
import FileUploadResModel from "@/common/model/file-upload-res.model";

/**
 * 公共API接口
 */
export default class commonApi {
	/**
	 * 获取XXX列表
	 */
	public static getMenuList(): Promise<ResponseModel> {
		return Service.request({
			url: 'sys/menu/getSysMenus',
			method: 'get'
		});
	};

	/**
	 * 文件上传
	 * @param data
	 */
	public static upload(data:FormData, progress?:Function,cancel?:Function): Promise<ResponseModel<FileUploadResModel>> {
		return Service.request({
			url: 'dfs/dfsAttach/uploadFile',
			method: 'post',
			data,
			progress,//是否需要上传进度
			cancel,//取消请求
		});
	};

}
